package com.youlai.common.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.youlai.sale.entity.SaleItemEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class MybatisBaseEntity extends Model<SaleItemEntity> implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Schema(description ="排序")
    private Integer sort;

    @Schema(description ="状态(1:正常;0:禁用)")
    private Integer status;

    @Schema(description ="备注")
    private String remark;

    @Schema(description ="逻辑删除标识(0:未删除;1:已删除)")
    private Integer deleted;

    @TableField(fill = FieldFill.INSERT)
    @JsonInclude(value = JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonInclude(value = JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private Long createBy;

    private Long updateBy;

    private String updateName;

    private String createName;

    @Schema(description="更新时间-结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField(exist = false)
    private String startUpdateTime;

    @Schema(description="更新时间-结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField(exist = false)
    private String endUpdateTime;

    @TableField(exist = false)
    private String order;

    @JsonIgnore
    public String getOrder() {
        return this.order;
    }

    @TableField(exist = false)
    private String sortBy;

    @JsonIgnore
    public String getSortBy() {
        return this.sortBy;
    }

    //condition  这个如果需要就提到父类去
    // 1:aa 2:bb 3:cc
    @TableField(exist = false)
    private Integer dataType;

    @JsonIgnore
    public Integer getDataType() {
        return this.dataType;
    }

    // 1:xx 2:yy 3:zz  这个如果需要就提到父类去
    @TableField(exist = false)
    private Integer businessTag;

    @JsonIgnore
    public Integer getBusinessTag() {
        return this.businessTag;
    }

    //stat
    @TableField(exist = false)
    @JsonIgnore
    private Integer statType;

    @JsonIgnore
    public Integer getStatType() {
        return this.statType;
    }

    @TableField(exist = false)
    private String statColumnName;

    @JsonIgnore
    public String getStatColumnName() {
        return this.statColumnName;
    }

    //group
    @TableField(exist = false)
    @JsonIgnore
    private Integer groupType;

    @JsonIgnore
    public Integer getGroupType() {
        return this.groupType;
    }

    @TableField(exist = false)
    private Double groupResult1;

    @Schema(description="关键字(组织名称)")
    @TableField(exist = false)
    private String keywords;

    @JsonIgnore
    public String getKeywords() {
        return this.keywords;
    }

    @Schema(description = "页码", required = true, example = "1")
    @TableField(exist = false)
    private Integer pageNum = 1;

    @Schema(description = "每页记录数", required = true, example = "10")
    @TableField(exist = false)
    private Integer pageSize = 10;
}
